
#include <stdint.h>
#include "MqttPublish_Data.h"

MqttPublish_Data_U MqttPublish_Data;


void MqttPublish_Init(void)
{
    for (int i = 0; i < MqttPublish_BufLength; i++)
    {
        MqttPublish_Data.MqttPublish_Buf[i] = 0;
    }
    MqttPublish_Data.MqttPublish_Msg.PubMsg_Coundown = 600;
}

uint8_t* MqttPublish_Encode(MqttPublish_Msg_S data)
{
    MqttPublish_Data.MqttPublish_Msg = data;
    return MqttPublish_Data.MqttPublish_Buf;
}

MqttPublish_Msg_S MqttPublis_Decode(uint8_t buf[])
{
    if(sizeof(buf) < MqttPublish_BufLength) return;

    for (int i = 0; i < MqttPublish_BufLength; i++)
    {
        MqttPublish_Data.MqttPublish_Buf[i] = buf[i];
    }
    return MqttPublish_Data.MqttPublish_Msg;
}
